home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / games / gg203.zip / SEND.BAS < prev    next >
BASIC Source File  |  1997-02-08  |  5KB  |  160 lines

  1. REM This program will convert "SEND" into "SENDREP.BAT" usable for
  2. REM PEGASUS MAIL.
  3. REM  ** WARNING **   ** WARNING **   ** WARNING **  ** WARNING **
  4. REM PEGASUS MUST NOT BE LOADED/RUNNING WHEN YOU EXECUTE THE BATCH FILE
  5. REM It will cause you hell, confusion, and gives you bad feedback :)
  6.  
  7. REM MOTD.TXT = Message of the Day text file
  8. REM SAMPLE DATA from "SEND"
  9. REM mail_report G777 0 "Player 1" erc118@psu.edu <reports/g777/1.rg7
  10.  
  11. PRINT "SEND.BAS : Converting SEND and reports for Pegasus Mail batch SENDREP"
  12.  
  13. OPEN "i", 1, "id.dta"
  14. LINE INPUT #1, pegasus.id$
  15. LINE INPUT #1, galaxy.directory$
  16. LINE INPUT #1, pegasus.full.path$
  17. CLOSE #1
  18.  
  19. IF pegasus.id$ = "missing_id" THEN
  20. redo.id:
  21.   OPEN "o", 1, "id.dta"
  22.   PRINT "Enter your Pegasus ID: ";
  23.   INPUT pegasus.id$
  24.   PRINT "Your ID: "; pegasus.id$, "  Correct? (y/n)"
  25.   INPUT test$
  26.   IF test$ = "Y" OR test$ = "y" THEN
  27.     PRINT #1, pegasus.id$
  28.   ELSE
  29.     CLOSE #1
  30.     GOTO redo.id
  31.   END IF
  32. redo.galaxy.directory:
  33.   PRINT "Enter your Galaxy directory (EXAMPLE: " + q$ + "d:\galaxy\" + q$ + ") ";
  34.   PRINT "Final Backslash '\' is important."
  35.   INPUT galaxy.directory$
  36.   PRINT "Your Galaxy Directory: "; galaxy.directory$, "  Correct? (y/n)"
  37.   INPUT test$
  38.   IF test$ = "Y" OR test$ = "y" THEN
  39.     PRINT #1, galaxy.directory$
  40.   ELSE
  41.     CLOSE #1
  42.     GOTO redo.galaxy.directory
  43.   END IF
  44. redo.pegasus.full.path:
  45.   PRINT "Enter your Pegasus FULL path"
  46.   PRINT "(EXAMPLE: " + q$ + "d:\net\pmail\winpm-32.exe" + q$ + ") "
  47.   INPUT pegasus.full.path$
  48.   PRINT #1, pegasus.full.path$
  49.   PRINT "Your Pegasus EXE path: "; pegasus.full.path$, "  Correct? (y/n)"
  50.   INPUT test$
  51.   IF test$ = "Y" OR test$ = "y" THEN
  52.     REM
  53.   ELSE
  54.     CLOSE #1
  55.     GOTO redo.pegasus.full.path
  56.   END IF
  57.   CLOSE #1
  58. END IF
  59. OPEN "i", 1, galaxy.directory$ + "send"
  60. OPEN "o", 2, galaxy.directory$ + "sendrep.bat"
  61. motd.file$ = galaxy.directory$ + "motd.txt"
  62. q$ = CHR$(34)
  63. PRINT #2, "@echo off"
  64. PRINT "Current Pegasus Mail ID: "; pegasus.id$
  65. PRINT "Current Galaxy directory: "; galaxy.directory$
  66. PRINT "Current Pegasus EXE full path: "; pegasus.full.path$
  67.  
  68. DO
  69.   GOSUB get.input
  70.   GOSUB get.input: game.name$ = data$
  71.   GOSUB get.input: turn$ = data$
  72.   GOSUB get.race: race.name$ = data$
  73.   GOSUB get.input: email.address$ = data$
  74.   GOSUB get.input: bad$ = data$: GOSUB to.dos
  75.     report.file.old$ = galaxy.directory$ + RIGHT$(data$, LEN(data$) - 1)
  76.     report.file.old$ = LEFT$(report.file.old$, LEN(report.file.old$) - 1)
  77.     report.file.new$ = LEFT$(report.file.old$, LEN(report.file.old$) - 4)
  78.     GOSUB find.filename
  79.  
  80.     REM  ** SHELL "ren " + report.file.old$ + " " + report.file.new$
  81.   
  82.     SHELL "copy " + motd.file$ + " " + report.path.new$ + report.file.new$
  83.     SHELL "type " + report.file.old$ + " >>" + report.path.new$ + report.file.new$
  84.     SHELL "del " + report.file.old$
  85.    
  86.     REM SHELL "gzip " + report.path.new$ + report.file.new$
  87.     REM SHELL "uue " + report.path.new$ + report.file.new$ + ".gz"
  88.     REM SHELL "del " + report.path.new$ + report.file.new$ + ".gz"
  89.     REM SHELL "del " + report.path.new$ + report.file.new$
  90.     REM END
  91.     IF email.address$ <> "rko" THEN
  92.       PRINT #2, "call " + pegasus.full.path$ + " -A -o -i " + pegasus.id$ + " ";
  93.       PRINT #2, "-t " + email.address$ + " ";
  94.       PRINT #2, "-s " + q$ + "(" + game.name$ + ") " + race.name$ + " Turn " + turn$ + " Report" + q$ + " ";
  95.       PRINT #2, "-f " + report.path.new$ + report.file.new$
  96.     END IF
  97. LOOP UNTIL EOF(1)
  98. CLOSE #1
  99. CLOSE #2
  100. PRINT "CLOSE Pegasus Mail and then start 'SENDREP.BAT'"
  101. SYSTEM
  102.  
  103. get.input:
  104.   data$ = ""
  105.   read.char$ = INPUT$(1, #1)
  106.   WHILE (read.char$ <> " ") AND (read.char$ <> CHR$(10))
  107.     data$ = data$ + read.char$
  108.     read.char$ = INPUT$(1, #1)
  109.   WEND
  110. RETURN
  111.  
  112. get.race:
  113.   data$ = ""
  114.   read.char$ = INPUT$(2, #1)
  115.   WHILE (read.char$ <> CHR$(34))
  116.     data$ = data$ + read.char$
  117.     read.char$ = INPUT$(1, #1)
  118.   WEND
  119.   data$ = data$ + read.char$
  120.   read.char$ = INPUT$(1, #1)
  121.  
  122.   REM strip ""
  123.   tmp.data$ = data$
  124.   data$ = ""
  125.   FOR race.inx = 1 TO LEN(tmp.data$)
  126.     tmp.char$ = MID$(tmp.data$, race.inx, 1)
  127.     IF tmp.char$ = q$ THEN tmp.char$ = "*"
  128.     data$ = data$ + tmp.char$
  129.   NEXT race.inx
  130. RETURN
  131.  
  132. to.dos:
  133.   data$ = ""
  134.   FOR t = 1 TO LEN(bad$)
  135.     IF MID$(bad$, t, 1) = "/" THEN
  136.       data$ = data$ + "\"
  137.     ELSE
  138.       data$ = data$ + MID$(bad$, t, 1)
  139.     END IF
  140.   NEXT t
  141. RETURN
  142.  
  143. find.filename:
  144.   data$ = ""
  145.   
  146.   t.index = LEN(report.file.new$)
  147.   DO
  148.     data$ = data$ + MID$(report.file.new$, t.index, 1)
  149.     t.index = t.index - 1
  150.   LOOP UNTIL (MID$(report.file.new$, t.index, 1) = "\")
  151.  
  152.   report.path.new$ = LEFT$(report.file.new$, t.index)
  153.   report.file.new$ = ""
  154.   FOR t.index = LEN(data$) TO 1 STEP -1
  155.     report.file.new$ = report.file.new$ + MID$(data$, t.index, 1)
  156.   NEXT t.index
  157.  
  158. RETURN
  159.  
  160.